<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>调整事件捕获顺序</title>
</head>
<body>
<div id="app">
    <!--默认事件的响应顺序：从内到外-->
    <div class="outer" v-on:click="divClicked">
        asdf

        <form action="">
            <input type="button" value="提交" v-on:click="buttonClicked">
        </form>
    </div>

    <!--使用 .catpture 修饰优先向所在元素进行响应，然后按照正常顺序进行响应-->
    <div class="outer" v-on:click.capture="divClicked">
        asdf

        <form action="">
            <input type="button" value="提交" v-on:click="buttonClicked">
        </form>
    </div>



</div>

<script type="module">
    import {createApp} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                function divClicked() {
                    console.log("点击了 div");
                }

                function buttonClicked() {
                    console.log("点击了 button");
                }

                return {
                    divClicked,
                    buttonClicked,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>